package cn.nju.zyy.service.person;

import org.springframework.stereotype.Component;

import cn.nju.zyy.model.person.Person;

@Component
public class EditServiceInMemory implements EditService {

	private static Person person;
	private static String[] carModels = { "Ford", "Nissan" };

	static {
		person = new Person();
		person.setFirstName("Bruce");
		person.setLastName("Phillips");
		person.setEmail("bp@gmail.com");
		person.setPhoneNumber("123-456-7890");
		person.setSport("basketball");
		person.setGender("not sure");
		person.setResidency("KS");
		person.setOver21(true);
		person.setCarModels(carModels);
	}

	@Override
	public Person getPerson() {
		return person;
	}

	@Override
	public void savePerson(Person personBean) {
		person.setFirstName(personBean.getFirstName());
		person.setLastName(personBean.getLastName());
		person.setEmail(personBean.getEmail());
		person.setPhoneNumber(personBean.getPhoneNumber());
		person.setSport(personBean.getSport());
		person.setGender(personBean.getGender());
		person.setResidency(personBean.getResidency());
		person.setOver21(personBean.isOver21());
		person.setCarModels(personBean.getCarModels());
	}

}
